%%
%% This is file `luatex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% luatex.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2007, 2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% This work consists of the main source file luatex.dtx
%% and the derived files
%%    luatex.sty, luatex.pdf, luatex.ins, luatex.drv, luatex-loader.sty,
%%    luatex-test1.tex, luatex-test2.tex, luatex-test3.tex,
%%    luatex-test4.tex, luatex-test5.tex, oberdiek.luatex.lua.
%% 
\begingroup
  \catcode44 12 % ,
  \catcode45 12 % -
  \catcode46 12 % .
  \catcode58 12 % :
  \catcode64 11 % @
  \expandafter\let\expandafter\x\csname ver@luatex.sty\endcsname
  \ifcase 0%
    \ifx\x\relax % plain
    \else
      \ifx\x\empty % LaTeX
      \else
        1%
      \fi
    \fi
  \else
    \catcode35 6 % #
    \catcode123 1 % {
    \catcode125 2 % }
    \expandafter\ifx\csname PackageInfo\endcsname\relax
      \def\x#1#2{%
        \immediate\write-1{Package #1 Info: #2.}%
      }%
    \else
      \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
    \fi
    \x{luatex}{The package is already loaded}%
    \endgroup
    \expandafter\endinput
  \fi
\endgroup
\begingroup
  \catcode35 6 % #
  \catcode40 12 % (
  \catcode41 12 % )
  \catcode44 12 % ,
  \catcode45 12 % -
  \catcode46 12 % .
  \catcode47 12 % /
  \catcode58 12 % :
  \catcode64 11 % @
  \catcode123 1 % {
  \catcode125 2 % }
  \expandafter\ifx\csname ProvidesPackage\endcsname\relax
    \def\x#1#2#3[#4]{\endgroup
      \immediate\write-1{Package: #3 #4}%
      \xdef#1{#4}%
    }%
  \else
    \def\x#1#2[#3]{\endgroup
      #2[{#3}]%
      \ifx#1\@undefined
        \xdef#1{#3}%
      \fi
      \ifx#1\relax
        \xdef#1{#3}%
      \fi
    }%
  \fi
\expandafter\x\csname ver@luatex.sty\endcsname
\ProvidesPackage{luatex}%
  [2009/04/10 v0.2 LuaTeX basic definition package (HO)]
\begingroup
  \catcode123 1 % {
  \catcode125 2 % }
  \def\x{\endgroup
    \expandafter\edef\csname LuT@AtEnd\endcsname{%
      \catcode35 \the\catcode35\relax
      \catcode64 \the\catcode64\relax
      \catcode123 \the\catcode123\relax
      \catcode125 \the\catcode125\relax
    }%
  }%
\x
\catcode35 6 % #
\catcode64 11 % @
\catcode123 1 % {
\catcode125 2 % }
\def\TMP@EnsureCode#1#2{%
  \edef\LuT@AtEnd{%
    \LuT@AtEnd
    \catcode#1 \the\catcode#1\relax
  }%
  \catcode#1 #2\relax
}
\TMP@EnsureCode{10}{12}% ^^J
\TMP@EnsureCode{34}{12}% "
\TMP@EnsureCode{36}{3}% $
\TMP@EnsureCode{39}{12}% '
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{43}{12}% +
\TMP@EnsureCode{44}{12}% ,
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{95}{12}% _ (other!)
\TMP@EnsureCode{96}{12}% `
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
  \input infwarerr.sty\relax
  \input ifluatex.sty\relax
\else
  \RequirePackage{infwarerr}[2007/09/09]%
  \RequirePackage{ifluatex}[2009/04/10]%
\fi
\ifluatex
\else
  \@PackageError{luatex}{%
    This package may only be run using LuaTeX%
  }\@ehc
  \LuT@AtEnd
  \expandafter\endinput
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
\else
  \RequirePackage{etex}[1998/03/26]%
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname et@xins\endcsname\relax
  \@PackageWarningNoLine{luatex}{%
    Support for eTeX is not loaded (etex.src)%
  }%
\else
  \def\LuT@temp#1{%
    \ifnum\count27#1=32768 %
      \count27#1=65536 %
    \fi
  }%
  \LuT@temp0%
  \LuT@temp1%
  \LuT@temp2%
  \LuT@temp3%
  \LuT@temp4%
  \LuT@temp5%
  \LuT@temp6%
  \let\newcount\globcount
  \let\newdimen\globdimen
  \let\newskip\globskip
  \let\newbox\globbox
\fi
\expandafter\ifx\csname @empty\endcsname\relax
  \def\@empty{}%
\fi
\expandafter\ifx\csname @gobble\endcsname\relax
  \long\def\@gobble#1{}%
\fi
\expandafter\ifx\csname @firstofone\endcsname\relax
  \long\def\@firstofone#1{#1}%
\fi
\expandafter\ifx\csname @firstoftwo\endcsname\relax
  \long\def\@firstoftwo#1#2{#1}%
\fi
\expandafter\ifx\csname @car\endcsname\relax
  \def\@car#1#2\@nil{#1}%
\fi
\expandafter\ifx\csname @cdr\endcsname\relax
  \def\@cdr#1#2\@nil{#2}%
\fi
\expandafter\ifx\csname @ifstar\endcsname\relax
  \def\@ifstar#1{%
    \@ifnextchar*{\@firstoftwo{#1}}%
  }%
  \long\def\@ifnextchar#1#2#3{%
    \let\reserved@d=#1%
    \def\reserved@a{#2}%
    \def\reserved@b{#3}%
    \futurelet\@let@token\@ifnch
  }%
  \def\@ifnch{%
    \ifx\@let@token\@sptoken
      \let\reserved@c\@xifnch
    \else
      \ifx\@let@token\reserved@d
        \let\reserved@c\reserved@a
      \else
        \let\reserved@c\reserved@b
      \fi
    \fi
    \reserved@c
  }%
  \let\LuT@temp\:%
  \def\:{\let\@sptoken= }%
  \: % explicit space
  \def\:{\@xifnch}%
  \expandafter\def\: {%
    \futurelet\@let@token\@ifnch
  }%
  \let\:\LuT@temp
\fi
\expandafter\ifx\csname @tempcnta\endcsname\relax
  \csname newcount\endcsname\@tempcnta
\fi
\expandafter\ifx\csname @tempcntb\endcsname\relax
  \csname newcount\endcsname\@tempcntb
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname newcommand\endcsname\relax
  \def\LuT@newcommand#1[#2]#3{%
    \ifx#1\@undefined
      \let#1\relax
    \else
      \ifx#1\relax
      \else
        \@PackageError{luatex}{%
          \string#1 is already defined.\MessageBreak
          Redefinition is skipped%
        }\@ehc
      \fi
    \fi
    \ifx#1\relax
      \ifcase#2 %
        \def#1{#3}%
      \or
        \def#1##1{#3}%
      \or
        \def#1##1##2{#3}%
      \or
        \def#1##1##2##3{#3}%
      \or
        \@INTERNAL@ERROR
      \fi
    \fi
  }%
\else
  \def\LuT@newcommand{\newcommand*}%
\fi
\newcount\LuT@AllocLuaState
\LuT@AllocLuaState=\z@
\LuT@newcommand\newluastate[1]{%
  \ifnum\LuT@AllocLuaState<65535 %
    \global\advance\LuT@AllocLuaState\@ne
    \allocationnumber\LuT@AllocLuaState
    \global\chardef#1=\allocationnumber
    \wlog{\string#1=\string\luastate\the\allocationnumber}%
  \else
    \errmessage{No room for a new \string\luastate}%
  \fi
}
\newcount\LuT@AllocAttribute
\LuT@AllocAttribute=\m@ne
\LuT@newcommand\newattribute[1]{%
  \ifnum\LuT@AllocAttribute<65535 %
    \global\advance\LuT@AllocAttribute\@ne
    \allocationnumber\LuT@AllocAttribute
    \global\attributedef#1=\allocationnumber
    \unsetattribute{#1}%
    \wlog{\string#1=\string\attribute\the\allocationnumber}%
  \else
    \errmessage{No room for a new \string\attribute}%
  \fi
}
\LuT@newcommand\setattribute[2]{%
  #1=\numexpr#2\relax
}
\LuT@newcommand\unsetattribute[1]{%
  #1=\m@ne
}
\newcount\LuT@AllocCatcodeTable
\LuT@AllocCatcodeTable=\m@ne
\newcount\CatcodeTableStack
\CatcodeTableStack=\z@
\LuT@newcommand\newcatcodetable[1]{%
  \ifnum\LuT@AllocCatcodeTable<1114110 % 0x10FFFF is maximal \chardef
    % or < 268435455 % 2^28 - 1
    \global\advance\LuT@AllocCatcodeTable by\tw@
    \allocationnumber=\LuT@AllocCatcodeTable
    \global\chardef#1=\allocationnumber
    \wlog{%
      \string#1=\string\catcodetable\the\allocationnumber
    }%
  \else
    \errmessage{No room for a new \string\catcodetable}%
  \fi
}%
\LuT@newcommand\IncCatcodeTableStack[0]{%
  \ifnum\CatcodeTableStack<268435454 %
    \global\advance\CatcodeTableStack by\tw@
  \else
    \@PackageError{luatex}{%
      Catcode table stack overflow%
    }\@ehd
  \fi
}
\LuT@newcommand\DecCatcodeTableStack[0]{%
  \ifnum\CatcodeTableStack>\z@
    \global\advance\CatcodeTableStack by-2 %
  \else
    \@PackageError{luatex}{%
      Catcode table stack is empty%
    }\@ehd
  \fi
}
\LuT@newcommand\SetCatcodeRange[3]{%
  \edef\LuT@temp{%
    \noexpand\@tempcnta=\the\@tempcnta
    \noexpand\@tempcntb=\the\@tempcntb
    \noexpand\count@=\the\count@
    \relax
  }%
  \@tempcnta=\numexpr#1\relax
  \@tempcntb=\numexpr#2\relax
  \count@=\numexpr#3\relax
  \loop
    \unless\ifnum\@tempcnta>\@tempcntb
    \catcode\@tempcnta=\count@
    \advance\@tempcnta by \@ne
  \repeat
  \LuT@temp
}
\newcatcodetable\CatcodeTableIniTeX
\newcatcodetable\CatcodeTableString
\newcatcodetable\CatcodeTableOther
\newcatcodetable\CatcodeTableLaTeX
\initcatcodetable\CatcodeTableIniTeX
\begingroup
  \def\@makeother#1{\catcode#1=12\relax}%
  \@firstofone{%
    \catcodetable\CatcodeTableIniTeX
    \begingroup
      \SetCatcodeRange{0}{8}{15}%
      \catcode9=10 % tab
      \catcode11=15 %
      \catcode12=13 % form feed
      \SetCatcodeRange{14}{31}{15}%
      \catcode35=6 % hash
      \catcode36=3 % dollar
      \catcode38=4 % ampersand
      \catcode94=7 % circumflex
      \catcode95=8 % underscore
      \catcode123=1 % brace left
      \catcode125=2 % brace right
      \catcode126=13 % tilde
      \catcode127=15 %
      \savecatcodetable\CatcodeTableLaTeX
    \endgroup
    \@makeother{0}% nul
    \@makeother{13}% carriage return
    \@makeother{37}% percent
    \@makeother{92}% backslash
    \@makeother{127}%
    \SetCatcodeRange{65}{90}{12}% A-Z
    \SetCatcodeRange{97}{122}{12}% a-z
    \savecatcodetable\CatcodeTableString
    \@makeother{32}% space
    \savecatcodetable\CatcodeTableOther
  \endgroup
}%
\def\LuT@NumStackEmpty{0}
\let\LuT@NumStack\LuT@NumStackEmpty
\LuT@newcommand\PushCatcodeTableNumStack[0]{%
  \xdef\LuT@NumStack{%
    {\the\catcodetable}\LuT@NumStack
  }%
}
\LuT@newcommand\PopCatcodeTableNumStack[0]{%
  \ifx\LuT@NumStack\LuT@NumStackEmpty
    \@PackageWarning{luatex}{Empty catcode table number stack}%
    \catcodetable\z@
  \else
    \catcodetable=\expandafter\@car\LuT@NumStack\@nil\relax
    \xdef\LuT@NumStack{%
      \expandafter\@cdr\LuT@NumStack\@nil
    }%
  \fi
}
\LuT@newcommand\BeginCatcodeRegime[1]{%
  \PushCatcodeTableNumStack
  \catcodetable=\numexpr#1\relax
  \IncCatcodeTableStack
  \savecatcodetable\CatcodeTableStack
  \catcodetable\CatcodeTableStack
}
\LuT@newcommand\EndCatcodeRegime[0]{%
  \DecCatcodeTableStack
  \PopCatcodeTableNumStack
}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
  \input luatex-loader.sty\relax
\else
  \RequirePackage{luatex-loader}[2009/04/10]%
\fi
\LuT@AtEnd
\endinput
%%
%% End of file `luatex.sty'.
